package com.itheima.test;

public class ForTest6 {
    /*
        需求：在控制台输出所有的水仙花数, 每一行打印2个数据

            153 370
            371 407
     */
    public static void main(String[] args) {

        int count = 0;

        for (int i = 100; i <= 999; i++) {
            int ge = i % 10;
            int shi = i / 10 % 10;
            int bai = i / 100;
            if (ge * ge * ge + shi * shi * shi + bai * bai * bai == i) {
                System.out.print(i + " ");
                count++;
                // 每一次查完数, 问, 是否到达了2的倍数
                if (count % 2 == 0) {
                    // 换行
                    System.out.println();
                }
            }
        }
    }
}
